package com.bluno.engine;


public class GameCreator {

	private boolean[] playerReady; 

	public GameCreator(int n)
	{
		playerReady = new boolean[n];
		for(int i = 0; i < n; ++i)
		{
			playerReady[i] = false;
		}
	}
	public void shuffle(Card[] deck)
	{
		for(int k = 0; k < 5; ++k)
		{
			for(int i = 0; i < deck.length; ++i)
			{
				int j = (int) (Math.random()*deck.length);
				Card tmp = deck[i];
				deck[i] = deck[j];
				deck[j] = tmp;
			}
		}
	}
	
	public String deckToString(Card[] deck)
	{
		String deckString = "$"; //Inicio do deck sempre tem um $.
		
		for(int i = 0; i < deck.length; ++i)
		{
			deckString += deck[i].getId();
		}
		
		return deckString;
	}
	public boolean[] getPlayerReady() {
		return playerReady;
	}
	public void setPlayerReady(boolean[] playerReady) {
		this.playerReady = playerReady;
	}
	
	public boolean arePlayersReady()
	{
		for(boolean ready: this.playerReady)
		{
			if(ready == false)
			{
				return false;
			}
		}
		return true;
	}
}
